package com.bianmaba.log;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;

/**
 * @program: hadoop-samples
 * @description:
 * @author: Chenjiabin
 * @create: 2019/6/11 16:58
 **/
public class GetRequestUri extends UDF {

    public Text evaluate(Text add) {
        // 过滤
        if (add == null) {
            return null;
        }
        // 按照空格分割
        String[] strings = add.toString().split(" ");
        // 过滤分割后长度小于3的字符
        if (strings.length < 3) {
            return null;
        }
        // 设置返回的结果
        Text result = new Text(strings[1]);
        return result;
    }
}
